cmake_minimum_required(VERSION 3.0.0)

set(MODULE_NAME "SocketUtils")
set(${MODULE_NAME}_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR};${CMAKE_CURRENT_SOURCE_DIR}/include" CACHE INTERNAL "${MODULE_NAME} of the sources direcotry.")
set(${MODULE_NAME}_LIBRARIES "${MODULE_NAME}" CACHE INTERNAL "${MODULE_NAME} of the library.")


include_directories(
    ${CMAKE_CURRENT_SOURCE_DIR}/include
)

add_library(${MODULE_NAME}
    "src/SocketUtils.c"
)

# add_subdirectory(lib/SocketUtils)
# target_include_directories(${MODULE_NAME} PRIVATE
#     ${SocketUtils_INCLUDE_DIRS}
# )
# target_link_libraries(${MODULE_NAME}
#     ${SocketUtils_LIBRARIES}
# )

# SocketUtils Test
option(ENABLE_SOCKETUTILS_TEST "Enable building SocketUtils test" ON)
if(ENABLE_SOCKETUTILS_TEST)
    add_subdirectory(lib/Log)
    add_subdirectory(test/socket-tests/socket-client-test)
    add_subdirectory(test/socket-tests/socket-server-test)
    add_subdirectory(test/socket-tests/udp-socket-client-test)
    add_subdirectory(test/socket-tests/udp-socket-server-test)
    add_subdirectory(test/socket-tests/select-udp-socket-test)
endif(ENABLE_SOCKETUTILS_TEST)